<?php

/**
 * Swoole WebSocketServer here
 */
namespace App\Controller\Ws;

use Hyperf\Contract\OnCloseInterface;
use Hyperf\Contract\OnMessageInterface;
use Hyperf\Contract\OnOpenInterface;
use Swoole\Http\Request;
use Swoole\Websocket\Frame;
use Swoole\WebSocket\Server as WebSocketServer;
use Service\WebSocketService\BaseWsService;

class ChannelWsServiceController implements OnMessageInterface, OnOpenInterface, OnCloseInterface
{
    public function onMessage($server, Frame $frame): void
    {
        BaseWsService::instance()->receiveMessage($server,$frame);
    }
    
    public function onClose($server, int $fd, int $reactorId): void
    {
        
    }
    
    public function onOpen($server, Request $request): void
    {
        //$server->push($request->fd, 'Opened');
    }
}